<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.7"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>qLibc: utilities/qcount.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">qLibc
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.7 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('qcount_8c.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">qcount.c File Reference</div></div>
</div><!--header-->
<div class="contents">

<p>Counter file handling APIs.  
<a href="#details">More...</a></p>

<p><a href="qcount_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ab55bb62b3e48c20841df25f9c3d933e9"><td class="memItemLeft" align="right" valign="top">int64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qcount_8c.html#ab55bb62b3e48c20841df25f9c3d933e9">qcount_read</a> (const char *filepath)</td></tr>
<tr class="memdesc:ab55bb62b3e48c20841df25f9c3d933e9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read counter(integer) from file with advisory file locking.  <br /></td></tr>
<tr class="separator:ab55bb62b3e48c20841df25f9c3d933e9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a75f48f5285204edd64b6ec20fc5dad3c"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qcount_8c.html#a75f48f5285204edd64b6ec20fc5dad3c">qcount_save</a> (const char *filepath, int64_t number)</td></tr>
<tr class="memdesc:a75f48f5285204edd64b6ec20fc5dad3c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save counter(integer) to file with advisory file locking.  <br /></td></tr>
<tr class="separator:a75f48f5285204edd64b6ec20fc5dad3c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad6c28da6fdf0ea2c69180eeb72994918"><td class="memItemLeft" align="right" valign="top">int64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qcount_8c.html#ad6c28da6fdf0ea2c69180eeb72994918">qcount_update</a> (const char *filepath, int64_t number)</td></tr>
<tr class="memdesc:ad6c28da6fdf0ea2c69180eeb72994918"><td class="mdescLeft">&#160;</td><td class="mdescRight">Increases(or decrease) the counter value as much as specified number with advisory file locking.  <br /></td></tr>
<tr class="separator:ad6c28da6fdf0ea2c69180eeb72994918"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Counter file handling APIs. </p>

<p class="definition">Definition in file <a class="el" href="qcount_8c_source.html">qcount.c</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="ab55bb62b3e48c20841df25f9c3d933e9" name="ab55bb62b3e48c20841df25f9c3d933e9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab55bb62b3e48c20841df25f9c3d933e9">&#9670;&#160;</a></span>qcount_read()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int64_t qcount_read </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filepath</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Read counter(integer) from file with advisory file locking. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">filepath</td><td>file path</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>counter value readed from file. in case of failure, returns 0.</dd></dl>
<div class="fragment"><div class="line"><a class="code hl_function" href="qcount_8c.html#a75f48f5285204edd64b6ec20fc5dad3c">qcount_save</a>(<span class="stringliteral">&quot;number.dat&quot;</span>, 75);</div>
<div class="line"><span class="keywordtype">int</span> count = <a class="code hl_function" href="qcount_8c.html#ab55bb62b3e48c20841df25f9c3d933e9">qcount_read</a>(<span class="stringliteral">&quot;number.dat&quot;</span>);</div>
<div class="ttc" id="aqcount_8c_html_a75f48f5285204edd64b6ec20fc5dad3c"><div class="ttname"><a href="qcount_8c.html#a75f48f5285204edd64b6ec20fc5dad3c">qcount_save</a></div><div class="ttdeci">bool qcount_save(const char *filepath, int64_t number)</div><div class="ttdoc">Save counter(integer) to file with advisory file locking.</div><div class="ttdef"><b>Definition</b> <a href="qcount_8c_source.html#l00095">qcount.c:95</a></div></div>
<div class="ttc" id="aqcount_8c_html_ab55bb62b3e48c20841df25f9c3d933e9"><div class="ttname"><a href="qcount_8c.html#ab55bb62b3e48c20841df25f9c3d933e9">qcount_read</a></div><div class="ttdeci">int64_t qcount_read(const char *filepath)</div><div class="ttdoc">Read counter(integer) from file with advisory file locking.</div><div class="ttdef"><b>Definition</b> <a href="qcount_8c_source.html#l00065">qcount.c:65</a></div></div>
</div><!-- fragment --><div class="fragment"><div class="line">---- number.dat ----</div>
<div class="line">75</div>
<div class="line">--------------------</div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qcount_8c_source.html#l00065">65</a> of file <a class="el" href="qcount_8c_source.html">qcount.c</a>.</p>

</div>
</div>
<a id="a75f48f5285204edd64b6ec20fc5dad3c" name="a75f48f5285204edd64b6ec20fc5dad3c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a75f48f5285204edd64b6ec20fc5dad3c">&#9670;&#160;</a></span>qcount_save()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool qcount_save </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filepath</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t&#160;</td>
          <td class="paramname"><em>number</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Save counter(integer) to file with advisory file locking. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">filepath</td><td>file path </td></tr>
    <tr><td class="paramname">number</td><td>counter integer value</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, otherwise returns false.</dd></dl>
<div class="fragment"><div class="line"><a class="code hl_function" href="qcount_8c.html#a75f48f5285204edd64b6ec20fc5dad3c">qcount_save</a>(<span class="stringliteral">&quot;number.dat&quot;</span>, 75);</div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qcount_8c_source.html#l00095">95</a> of file <a class="el" href="qcount_8c_source.html">qcount.c</a>.</p>

</div>
</div>
<a id="ad6c28da6fdf0ea2c69180eeb72994918" name="ad6c28da6fdf0ea2c69180eeb72994918"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad6c28da6fdf0ea2c69180eeb72994918">&#9670;&#160;</a></span>qcount_update()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int64_t qcount_update </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filepath</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t&#160;</td>
          <td class="paramname"><em>number</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Increases(or decrease) the counter value as much as specified number with advisory file locking. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">filepath</td><td>file path </td></tr>
    <tr><td class="paramname">number</td><td>how much increase or decrease</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>updated counter value. in case of failure, returns 0.</dd></dl>
<div class="fragment"><div class="line"><span class="keywordtype">int</span> count;</div>
<div class="line">count = <a class="code hl_function" href="qcount_8c.html#ad6c28da6fdf0ea2c69180eeb72994918">qcount_update</a>(<span class="stringliteral">&quot;number.dat&quot;</span>, -3);</div>
<div class="ttc" id="aqcount_8c_html_ad6c28da6fdf0ea2c69180eeb72994918"><div class="ttname"><a href="qcount_8c.html#ad6c28da6fdf0ea2c69180eeb72994918">qcount_update</a></div><div class="ttdeci">int64_t qcount_update(const char *filepath, int64_t number)</div><div class="ttdoc">Increases(or decrease) the counter value as much as specified number with advisory file locking.</div><div class="ttdef"><b>Definition</b> <a href="qcount_8c_source.html#l00124">qcount.c:124</a></div></div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qcount_8c_source.html#l00124">124</a> of file <a class="el" href="qcount_8c_source.html">qcount.c</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_7b5d38f1875f1b693f62ca6a108a1129.html">utilities</a></li><li class="navelem"><a class="el" href="qcount_8c.html">qcount.c</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.7 </li>
  </ul>
</div>
</body>
</html>
